
Texbank: texbank
              0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
              0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
              0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
              0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
              0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
              0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
              0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
              0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,

0 value t

: gl-init ( -- )
  load-gl-extensions
  cls texbank texbank-init
  texbank texbank-surface surface-texture to t
  2dmode
  enable-alpha-test
  enable-depth-test
  glEnable( GL_TEXTURE_2D )
  glBindTexture( t GL_TEXTURE_2D )
  mv-identity
  pm-identity
  tm-identity
  0 1.0 1.0 texturebank-section
  vbo-vertex-drawing-init
  ;

: shutdown ( -- )
  'onexit calls
  0 ExitProcess ;

defer main
:[] main:[  is main ;

:noname
  main:[
    0.5e 0.5e 0.5e 1.0e glClearColor
    cls ;] ; execute

: user-exit-key?
  <f4> key? alt? and ;

: init
  /onload
  display? not if 640 480 false s" Game" init-display then
  input-init
  gl-init ;

: go ( -- )
  init
  begin  poll-all  ['] main catch  end-frame   user-exit-key? or until
  shutdown
  ;

